package com.vova;

import java.util.LinkedHashMap;
import java.util.Map;

public class MyMap<K, V> extends LinkedHashMap<K, V> {
    private static final long serialVersionUID = 7907711919543506269L;

    private final int maxCapacity;

    public MyMap(int maxCapacity) {
        this.maxCapacity = maxCapacity;
    }

    @Override
    protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
        return size() > maxCapacity;
    }
}
